//
//  XDMiyoshiBankViewController.m
//  XDEducation
//
//  Created by 星道 on 17/5/13.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "XDMiyoshiBankViewController.h"

#import "XDMiyoshiBankCountViewController.h" //累计
#import "XDMiyoshiBankTodayViewController.h" //今日
#import "HNBankListController.h"             //明细
#import "HNBankRecordController.h"           //记录
@interface XDMiyoshiBankViewController ()

//静态表单数据
@property (nonatomic, strong) NSArray *staticArr;

@end

@implementation XDMiyoshiBankViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.tableView.scrollEnabled = NO;
}



#pragma mark - TableViewDelegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return [self.staticArr count];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *Cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
    if (!Cell)
    {
        Cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:@"Cell"];
        Cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        Cell.textLabel.font = [UIFont systemFontOfSize:14.f];
        Cell.textLabel.backgroundColor = UIColorFromRGB(0X4C4C4C);
        Cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    Cell.textLabel.text = self.staticArr[indexPath.section][@"name"];
    Cell.imageView.image = [UIImage imageNamed:self.staticArr[indexPath.section][@"icon"]];
    return Cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    Class a = NSClassFromString(self.staticArr[indexPath.section][@"vc"]);
    UIViewController *VC = [[a alloc] init];
    VC.title = self.staticArr[indexPath.section][@"name"];
    [self.navigationController pushViewController:VC animated:YES];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 64.4f;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 10;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 1;
}


#pragma mark - Setter
- (NSArray *)staticArr
{
    if (!_staticArr)
    {
        _staticArr = @[
                       @{@"icon":@"bank_icon_accumulate_default",@"name":@"累计",@"vc":@"XDMiyoshiBankCountViewController"},
                       @{@"icon":@"bank_icon_today_default",@"name":@"今日",@"vc":@"XDMiyoshiBankTodayViewController"},
                       @{@"icon":@"bank_icon_detail_default",@"name":@"明细",@"vc":@"HNBankListController"},
                       @{@"icon":@"bank_icon_record_default",@"name":@"记录",@"vc":@"HNBankRecordController"}
                       ];
    }
    return _staticArr;
}
@end
